package shinesend.com.cn.level_3_cache.lib;

import android.content.Context;
import android.os.Environment;

import java.io.File;

/**
 * Created by MyPC on 2016/11/25.
 */
public class PanoramaConfig {

    private static String CACHEDIR = "panoramaCache";
    private File cacheDir;
    private PanoramaConfig config;
    private PanoramaConfig(Context ctx){

        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
            cacheDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
        }else{
            cacheDir = Environment.getDataDirectory();
        }
        if (cacheDir != null) {
            cacheDir = new File(cacheDir.getAbsolutePath()+File.separator+CACHEDIR);
        }
        if (!cacheDir.exists()) {
            cacheDir.mkdirs();
        }
    }
    public static PanoramaConfig getInstance (Context ctx) {
        return new PanoramaConfig(ctx);
    }
    public File getCacheDir() {
        return cacheDir;
    }
}
